﻿using System;
using System.IO;
using System.Windows.Forms;

namespace todo
{
    public partial class PropertiesForm : Form
    {
        public PropertiesForm()
        {
            InitializeComponent();
        }

        private void PropertiesForm_Load(object sender, EventArgs e)
        {
            this.Text = Path.GetFileName(App.TodoListFile) + " Properties";
            this.txtTitle.Text = App.TodoList.Title;
            this.txtAuthor.Text = App.TodoList.Author;
            this.txtComments.Text = App.TodoList.Comments;

            Localize();
        }

        private void Localize()
        {
#if zh
            this.Text = Path.GetFileName(App.TodoListFile) + " 属性";
            this.lblTitle.Text = "标题";
            this.lblAuthor.Text = "作者";
            this.lblComments.Text = "备注";
            this.btnOk.Text = "确定";
            this.btnCancel.Text = "取消";
#endif
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            App.TodoList.Title = this.txtTitle.Text;
            App.TodoList.Author = this.txtAuthor.Text;
            App.TodoList.Comments = this.txtComments.Text;
            App.Dirty = true;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}